package com.catsic.core.rmi;

import java.util.List;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.catsic.core.utils.PackageUtil;

public class CatsRmiServer {

	//自动发布所有rmi服务
	//遍历所有接口
	//注册为spring bean
	
	
	public List<String> IssueServices(String packages){
		
		String[] thepackage = packages.split("\\.\\*\\.");//拆分包名
		List<String> allrmiservices = null;
		//获得所有RMI接口
		if(thepackage.length>1)
			allrmiservices = PackageUtil.getClassName(thepackage[0], thepackage[1]);
		else
			allrmiservices = PackageUtil.getClassName(packages,null);
		
		return allrmiservices;
	}
	
	public static void main(String[] args) {  
        // TODO Auto-generated method stub   
        System.out.println("rmi服务端启动");  
        @SuppressWarnings({ "unused", "resource" })
		ApplicationContext ctx = new ClassPathXmlApplicationContext("classpath*:spring/applicationContext*.xml");  
        System.out.println("rmi服务端启动完成。。。");  
    }  

}
